import request from "../config/request";

//获取一级商品分类
export function findItemCat(data) {
  return request({
    url: "app/user/itemCat/findItemCat/" + data,
    method: "get"
  });
}
//获取二级商品分类
export function findChildItemCatByNo(data) {
  return request({
    url: "app/user/item/showItemByCatNo",
    method: "get",
    params: data
  });
}
//获取首页商品
export function randomItem(data) {
  return request({
    url: "app/user/item/randomItem",
    method: "get",
    params: data
  });
}
//获取商品详情
export function findGoodsByItemNo(data) {
  return request({
    url: "app/user/item/findGoodsByItemNo/" + data,
    method: "get"
  });
}
export function addShoppingCart(data) {
  return request({
    url: "app/user/cart/addShoppingCart",
    method: "post",
    params: data
  });
}
//获取客户订单
export function findOrderByInviteUserNo(params) {
  return request({
    url: "app/user/order/findOrderByInviteUserNo",
    method: "post",
    data: params
  });
}
//获取客户推荐订单
export function findOrderByRecvUserNo(params) {
  return request({
    url: "app/user/order/findOrderByRecvUserNo",
    method: "post",
    data: params
  });
}

//获取当前用户的所有订单列表
export function findAllOrder(params) {
  return request({
    url: "app/user/order/findAllOrder",
    method: "post",
    data: params
  });
}
//按照订单状态查询当前用户的订单列表
export function findOrderByStatus(params) {
  return request({
    url: "app/user/order/findOrderByStatus",
    method: "post",
    data: params
  });
}
//创建订单
export function createOrder(params) {
  return request({
    url: "app/user/order/createOrder",
    method: "post",
    data: params
  });
}
//按照订单号查询订单信息
export function findOrderByNo(params) {
  return request({
    url: "/app/user/order/findOrderByNo/"+params.orderNo,
    method: "post",
    data: params
  });
}
//取消订单
export function cancelOrder(params) {
  return request({
    url: "app/user/order/cancelOrder",
    method: "post",
    data: params
  });
}
//确认收货
export function confirmRecv(params) {
  return request({
    url: "/app/user/order/confirmRecv",
    method: "post",
    data: params
  });
}
//修改订单
export function updateOrder(params) {
  return request({
    url: "/app/user/order/updateOrder",
    method: "post",
    data: params
  });
}
//获取客户列表
export function findAddrList(data) {
  return request({
    url: "/app/user/findCustomerList",
    method: "get",
    params: data
  });
}
//新增用户地址信息
export function createCustomer(params) {
  return request({
    url: "app/user/createCustomer",
    method: "post",
    data: params
  });
}
// //修改地址信息
// export function modiAddr(params) {
//   return request({
//     url: "app/user/addr/modiAddr",
//     method: "post",
//     data: params
//   });
// }
//修改客户信息
export function updateUser(params) {
  return request({
    url: "app/user/update",
    method: "post",
    data: params
  });
}
//根据id查询地址
export function findAddrById(data) {
  return request({
    url: "app/user/addr/findAddrById/"+data.id,
    method: "get",
  });
}
//删除用户地址
export function deleteById(data) {
  return request({
    url: "/app/user/delete/"+data.id,
    method: "post",
  });
}
// 用户账户
export function findAccount() {
  return request({
    url: '/app/user/account/findAccount',
    method: 'post'
  })
}
// 全部用户信息
export function getAllUser() {
  return request({
    url: '/app/user/listAll',
    method: 'post'
  })
}
// 用户信息
export function getSysCompany() {
  return request({
    url: '/app/user/sysCompany/listAll',
    method: 'post'
  })
}
// 优惠金额信息
export function calBenefitByProd(prodSaleAmt) {
  return request({
    url: `/app/billItem/calBenefitByProd/${prodSaleAmt}`,
    method: 'post'
  })
}

// 客户列表
export function findCustomerList() {
  return request({
    url: '/app/user/findCustomerList',
    method: 'get'
  })
}
// 账户积分获取接口
export function findScoreAccount() {
  return request({
    url: '/app/user/account/findScoreAccount',
    method: 'post'
  })
}
// 用户信息
export function getCurrentUser() {
  return request({
    url: '/app/user/getCurrentUser',
    method: 'get'
  })
}
//提现申请
export function withDraw(params) {
  return request({
    url: "app/user/withDraw/apply",
    method: "post",
    data: params
  });
}
//获取支付方式
export function accountLog(params) {
  return request({
    url: "app/user/accountLog/listPage",
    method: "post",
    data: params
  });
}
//获取支付方式
export function findPayWayList(params) {
  return request({
    url: "app/user/pay/findPayWayList/H5_WEB",
    method: "post",
    data: params
  });
}
//发起支付
export function startPay(data) {
  return request({
    url: "app/user/pay/startPay",
    method: "get",
    params: data
  });
}
//获取购买方式
export function findBuyWayList() {
  return request({
    url: "common/dict/findBuyWayList",
    method: "get"
  });
}

//结算单明细
export function settleDetail(params) {
  return request({
    url: "app/user/report/settleDetail",
    method: "post",
    data: params
  });
}

//分红明细
export function bonusDetail(params) {
  return request({
    url: "/app/user/report/bonusDetail",
    method: "post",
    data: params
  });
}

//分润明细
export function profitDetail(params) {
  return request({
    url: "/app/user/report/profitDetail",
    method: "post",
    data: params
  });
}